<template>
  <div class="_cart">
    <template v-if="currData instanceof Array && currData.length > 0">
      <el-table :data="currData">
        <template v-for="(val, key) in currData" :key="key">
          <el-table-column :label="key" prop="key"></el-table-column>
        </template>
      </el-table>
    </template>
    <template v-else-if="currData instanceof Object">
      <el-descriptions border>
        <el-descriptions-item
          :width="30"
          v-for="(val, key) in currData"
          :key="key"
          :label="key"
        >
          {{ val }}
        </el-descriptions-item>
      </el-descriptions>
    </template>
    <template v-else>{{ currData }}</template>
  </div>
</template>
<script>
export default {
  props: {
    comData: {
      type: [Array, Object, String, Number],
      required: false,
    },
  },
  data() {
    return {
      currPath: [],
    };
  },
  computed: {
    currData() {
      if (this.currPath.length < 1) {
        return this.comData;
      }
      let tempData = this.comData;
      this.currPath.forEach((path) => {
        tempData = tempData[path];
      });
      return tempData;
    },
  },
};
</script>
<style lang=""></style>
